package org.judo.menu;

import java.util.ArrayList;

import org.judo.admin.identity.AppUser;

public class Menu
{
	private String name;
	ArrayList<MenuItem> menuItems = new ArrayList<MenuItem>();
	
	public ArrayList<MenuItem> menuItems(AppUser user)
	{
		ArrayList<MenuItem> ret = new ArrayList<MenuItem>();
		
		for (MenuItem item:menuItems)
		{
			//item.roleMap
			
			if (user == null)
			{
				if (item.logged_out.equals("true"))
					ret.add(item);
			}
			else
			{
				if (item.logged_in.equals("true"))
					ret.add(item);
			}
		}
		
		return ret;
	}
	
	public void addMenuItem(MenuItem item)
	{
		menuItems.add(item);
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}
}
